home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
example
/
adremove.frm
next >
Wrap
Text File
|
1995-05-08
|
3KB
|
139 lines
VERSION 2.00
Begin Form frmPractice
Caption = "Add, Remove, Clear"
ClientHeight = 3225
ClientLeft = 1845
ClientTop = 1620
ClientWidth = 3615
Height = 3630
Left = 1785
LinkTopic = "Form1"
ScaleHeight = 3225
ScaleWidth = 3615
Top = 1275
Width = 3735
Begin CommandButton cmdClear
Caption = "C&lear"
Height = 372
Left = 2400
TabIndex = 8
Top = 1560
Width = 972
End
Begin CommandButton cmdRemove
Caption = "&Remove"
Height = 372
Left = 2400
TabIndex = 7
Top = 960
Width = 972
End
Begin CommandButton cmdAdd
Caption = "&Add"
Height = 372
Left = 2400
TabIndex = 6
Top = 360
Width = 972
End
Begin ListBox lstClient
Height = 1560
Left = 120
Sorted = -1 'True
TabIndex = 5
Top = 840
Width = 1812
End
Begin TextBox txtName
Height = 288
Left = 120
TabIndex = 1
Top = 360
Width = 1812
End
Begin CommandButton cmdEixt
Caption = "&Exit"
Height = 372
Left = 2400
TabIndex = 0
Top = 2640
Width = 972
End
Begin Label lblDisplay
BorderStyle = 1 'Fixed Single
Height = 252
Left = 960
TabIndex = 4
Top = 2640
Width = 732
End
Begin Label lblClients
Caption = "#Clients"
Height = 252
Left = 120
TabIndex = 3
Top = 2640
Width = 732
End
Begin Label lblName
Caption = "Name to add"
Height = 252
Left = 120
TabIndex = 2
Top = 120
Width = 1572
End
End
Option Explicit
Sub cmdAdd_Click ()
Dim Client As String
If txtName.Text = "" Then
lblDisplay.Caption = lstClient.ListCount
Else
Client = txtName.Text
lstClient.AddItem Client
txtName.Text = ""
lblDisplay.Caption = lstClient.ListCount
End If
End Sub
Sub cmdClear_Click ()
lstClient.Clear
lblDisplay.Caption = lstClient.ListCount
End Sub
Sub cmdEixt_Click ()
Beep
End
End Sub
Sub cmdRemove_Click ()
Dim Ind As Integer
Ind = lstClient.ListIndex
If Ind >= 0 Then
lstClient.RemoveItem Ind
lblDisplay.Caption = lstClient.ListCount
Else
Beep
End If
End Sub
Sub Form_Load ()
' Initialize # of client to 0.
lblDisplay.Caption = "0"
End Sub